import React from 'react'
export function useObject<T>(initialState: T) {
  const [state, setState] = React.useState<T>(initialState)
  const updateFn = React.useCallback((partial: Partial<T>) => {
    setState((prev) => ({ ...prev, ...partial }))
  }, [])
  return [state, updateFn] as const
}
